package com.sfchen.cloud.controller;

import com.sfchen.cloud.dto.UserDto;
import com.sfchen.cloud.feign.service.UserFeignDetailService;
import com.sfchen.cloud.utils.JsonData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@AllArgsConstructor
@RequestMapping()
@Tag(name = "用户信息")
public class UserController {

    private final UserFeignDetailService userFeignDetailService;

    @Operation(summary = "根据用户id获取用户信息")
    @Parameter(name = "userId", required = true, example = "1",description = "用户id")
    @GetMapping("/detail/{userId}")
    public JsonData<UserDto> queryDetailById(@PathVariable("userId") Integer userId) {
        return userFeignDetailService.queryUserDetailById(userId);
    }
}
